/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function ajaxFunction(a,b) {
    
    var xmlHttp;
        
	try {
        // Firefox, Opera 8.0+, Safari
	xmlHttp = new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
        
	xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState == 4) {
                     if(xmlHttp.status == 200){
                        reponse = JSON.parse(xmlHttp.responseText);
                        // get the div
                        var div = document.getElementById('page');
                        // remove child nodes while at least one exists
                        while( div.childNodes[0] ) {
                            div.removeChild( div.childNodes[0] );
                        }
                        // create a new span element
                        var span = document.createElement( 'span' );
                        // give it some text content
                        span.appendChild( document.createTextNode(reponse.prixDevise) );
                        
                        // append the span to the original div
                        div.appendChild( span );         
                     }
                     
                     else alert("Réponse invalide")
		}
	}
        
	xmlHttp.open("GET", "/ecomProject-war/selectDevise.action?prixProduit="+a+"&choixCurrencySymbol="+b, true);
        xmlHttp.send(null);
}
    

